class MyCircularQueue
{
public:
    MyCircularQueue(int k) : mod(k + 1), data(vector<int>(k + 1)), front(0), rear(0)
    {
    }

    bool enQueue(int value)
    {
        if (isFull())
        {
            return false;
        }
        else
        {
            data[rear] = value;
            rear = (rear + 1) % mod;
            return true;
        }
    }

    bool deQueue()
    {
        if (isEmpty())
        {
            return false;
        }
        else
        {
            front = (front + 1) % mod;
            return true;
        }
    }

    int Front()
    {
        if (isEmpty())
        {
            return -1;
        }
        else
        {
            return data[front];
        }
    }

    int Rear()
    {
        if (isEmpty())
        {
            return -1;
        }
        else
        {
            return data[(rear + mod - 1) % mod];
        }
    }

    bool isEmpty()
    {
        return front == rear;
    }

    bool isFull()
    {
        return ((rear + 1) % mod) == front;
    }

private:
    vector<int> data;
    int rear;
    int front;
    int mod;
};

/**
 * Your MyCircularQueue object will be instantiated and called as such:
 * MyCircularQueue* obj = new MyCircularQueue(k);
 * bool param_1 = obj->enQueue(value);
 * bool param_2 = obj->deQueue();
 * int param_3 = obj->Front();
 * int param_4 = obj->Rear();
 * bool param_5 = obj->isEmpty();
 * bool param_6 = obj->isFull();
 */